﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPIS.DBM;
using KPIS.GERP.GFMS.MODEL;
using KPIS.GERP.GFMS.IBLL;
using KPIS.GERP.GFMS.IDAL;
using KPIS.GERP.GFMS.DALFactory;

namespace KPIS.GERP.GFMS.BLL
{
    public class B_HRM_PS_Employees : IBLL_HRM_PS_Employees
    {
        Common common = new Common();
        private static readonly IDAL_HRM_PS_Employees dal = DataAccess.Create_HRM_PS_Employees();

        public B_HRM_PS_Employees()
        {

        }

        public IList<M_HRM_PS_Employees> GetFull(string emp_type_seq
            , string job_site_seq, string working_job_site_seq)
        {
            Nullable<int> nemp_type_seq = common.ConvertNullInt(emp_type_seq);
            Nullable<int> njob_site_seq = common.ConvertNullInt(job_site_seq);
            Nullable<int> nworking_job_site_seq = common.ConvertNullInt(working_job_site_seq);

            return dal.GetFull(nemp_type_seq, njob_site_seq, nworking_job_site_seq);
        }

        public IList<M_HRM_PS_Employees> GetList(string emp_type_seq
            , string job_site_seq, string working_job_site_seq, string filter)
        {
            Nullable<int> nemp_type_seq = common.ConvertNullInt(emp_type_seq);
            Nullable<int> njob_site_seq = common.ConvertNullInt(job_site_seq);
            Nullable<int> nworking_job_site_seq = common.ConvertNullInt(working_job_site_seq);

            return dal.GetList(nemp_type_seq, njob_site_seq, nworking_job_site_seq, filter);
        }

        public IList<M_HRM_PS_Employees> GetListByEmpType(string emp_type_seq
            , string job_site_seq, string working_job_site_seq, string filter)
        {
            Nullable<int> njob_site_seq = common.ConvertNullInt(job_site_seq);
            Nullable<int> nworking_job_site_seq = common.ConvertNullInt(working_job_site_seq);

            return dal.GetListByEmpType(emp_type_seq, njob_site_seq, nworking_job_site_seq, filter);
        }

        public M_HRM_PS_Employees GetInfo(string seq)
        {
            int nSeq;

            if (seq == null)
                return null;

            if (common.IsNumeric(seq))
            {
                nSeq = int.Parse(seq);
                return dal.GetInfo(nSeq);
            }
            else
            {
                return null;
            }
        }

        public M_HRM_PS_Employees GetAddressInfo(string seq)
        {
            int nSeq;

            if (seq == null)
                return null;

            if (common.IsNumeric(seq))
            {
                nSeq = int.Parse(seq);
                return dal.GetAddressInfo(nSeq);
            }
            else
            {
                return null;
            }
        }

        public DataTable ListEmployeeByType(string strEmpTypeSeq, string strJobSiteSeq)
        {
            return dal.ListEmployeeByType(strEmpTypeSeq, strJobSiteSeq);
        }
    }
}
